Skip to content

Commit

Permalink
add anca.json
Browse files Browse the repository at this point in the history
add exact node.js version to github-actions and devcontainers
add anca.json prettier ignore action
  • Loading branch information
TimurRin committed Jul 21, 2024
1 parent 132abc8 commit 6f554e5
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 64 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
jobs:
publish-npm:
runs-on: ubuntu-latest
env:
ANCA_CI: true
name: "Publish package to npm registry"
steps:
- uses: actions/checkout@v4
Expand All @@ -31,6 +33,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
env:
ANCA_CI: true
name: Build executables on ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ package-lock.json
**/cinnabar.js
**/cinnabar.ts
cinnabar.json

# Anca
anca.json
34 changes: 32 additions & 2 deletions anca.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,39 @@
"url": "https://timurrin.github.io/"
}
],
"cinnabarMeta": {
"dataVersion": 0,
"version": {
"latest": "0.1.0-dev",
"timestamp": 1720199005
},
"files": [
{
"path": "./package.json",
"type": "nodejs-package-json"
},
{
"path": "./package-lock.json",
"type": "nodejs-package-lock-json"
},
{
"path": "./src/cinnabar.ts",
"type": "typescript"
}
],
"repo": {
"type": "github",
"value": "cinnabar-forge/anca"
}
},
"deployment": {
"preparation": ["npm ci", "npm run build"],
"start": ["node ./dist/index.js"]
"preparation": [
"npm ci",
"npm run build"
],
"start": [
"node ./dist/index.js"
]
},
"development": {
"readme": {}
Expand Down
23 changes: 0 additions & 23 deletions cinnabar.json

This file was deleted.

7 changes: 4 additions & 3 deletions src/actions/devcontainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from "path";

import { AncaDevelopment } from "../schema.js";
import { stringifyJson, writeFolderJsonFile } from "../utils.js";
import { NODEJS_22_VERSION, NODEJS_22_VERSION_SHA } from "./variables.js";

const JSON_FALLBACK = {
build: {
Expand Down Expand Up @@ -46,15 +47,15 @@ const JSON_NODEJS = {
name: "Node.js 22",
};

const DOCKERFILE_NODEJS = `FROM docker.io/node:22.4.0
const DOCKERFILE_NODEJS = `FROM docker.io/node:${NODEJS_22_VERSION}
USER node
`;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const DOCKERFILE_NODEJS_INSTALL = `# Install Node.js
ENV NODE_VERSION 22.3.0
ENV NODE_CHECKSUM sha256:a6d4fbf4306a883b8e1d235a8a890be84b9d95d2d39b929520bed64da41ce540
ENV NODE_VERSION ${NODEJS_22_VERSION}
ENV NODE_CHECKSUM sha256:${NODEJS_22_VERSION_SHA}
ADD --checksum=$NODE_CHECKSUM https://nodejs.org/dist/v\${NODE_VERSION}/node-v\${NODE_VERSION}-linux-x64.tar.gz /node.tar.gz
RUN tar -xz -f /node.tar.gz -C /usr/local --remove-files --strip-components=1
`;
Expand Down
19 changes: 15 additions & 4 deletions src/actions/github-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import fs from "fs";
import path from "path";

import { AncaDevelopment } from "../schema.js";
import {
NODEJS_18_VERSION,
NODEJS_20_VERSION,
NODEJS_22_VERSION,
} from "./variables.js";

const RELEASE_NODEJS = `name: Release
Expand All @@ -12,13 +17,15 @@ on:
jobs:
publish-npm:
runs-on: ubuntu-latest
env:
ANCA_CI: true
name: "Publish package to npm registry"
steps:
- uses: actions/checkout@v4
name: "Checkout repo"
- uses: actions/setup-node@v4
with:
node-version: 22
node-version: ${NODEJS_22_VERSION}
registry-url: https://registry.npmjs.org/
name: "Install Node.js"
- run: npm ci
Expand All @@ -42,13 +49,15 @@ on:
jobs:
publish-npm:
runs-on: ubuntu-latest
env:
ANCA_CI: true
name: "Publish package to npm registry"
steps:
- uses: actions/checkout@v4
name: "Checkout repo"
- uses: actions/setup-node@v4
with:
node-version: 22
node-version: ${NODEJS_22_VERSION}
registry-url: https://registry.npmjs.org/
name: "Install Node.js"
- run: npm ci
Expand All @@ -67,13 +76,15 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
env:
ANCA_CI: true
name: Build executables on \${{ matrix.os }}
steps:
- uses: actions/checkout@v4
name: Checkout repo
- uses: actions/setup-node@v4
with:
node-version: 22
node-version: ${NODEJS_22_VERSION}
name: Install Node.js
- run: npm ci
name: Install dependencies
Expand Down Expand Up @@ -107,7 +118,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18, 20, 22]
node: [${NODEJS_18_VERSION}, ${NODEJS_20_VERSION}, ${NODEJS_22_VERSION}]
name: Test repo on Node.js \${{ matrix.node }}
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions src/actions/nodejs-prettier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ package-lock.json
**/cinnabar.js
**/cinnabar.ts
cinnabar.json
# Anca
anca.json
`;

const RC_FILE_PATH = ".prettierrc";
Expand Down
5 changes: 5 additions & 0 deletions src/actions/variables.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const NODEJS_18_VERSION = "18.20.4";
export const NODEJS_20_VERSION = "20.15.1";
export const NODEJS_22_VERSION = "22.4.1";
export const NODEJS_22_VERSION_SHA =
"addb41bd7d5bdef51dc3bd76292889692664b3c9de1b7c5f89aba95e474aee84"; // node-vX.Y.Z-linux-x64.tar.gz
27 changes: 3 additions & 24 deletions src/cinnabar.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
// This file was generated by Cinnabar Forge Meta. Do not edit.
// This file was generated by Cinnabar Meta. Do not edit.

export default {
"cinnabarMetaVersion": 1,
"description": "Organize workspaces and manage projects deployment fast and easy",
"name": "Anca",
"version": {
"major": 0,
"minor": 1,
"patch": 0,
"prefix": "dev",
"revision": 0,
"text": "0.1.0-dev",
"timestamp": 1720199005
},
"stack": {
"nodejs": {
"outputFile": [
"src",
"cinnabar.js"
],
"package": "anca"
}
}
};
export const CINNABAR_PROJECT_TIMESTAMP = 1720199005;
export const CINNABAR_PROJECT_VERSION = "0.1.0-dev";
14 changes: 8 additions & 6 deletions src/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function parseSemver(version: string) {
preReleaseNumber,
};
} else {
throw new Error("Invalid version format");
return false;
}
}

Expand Down Expand Up @@ -110,11 +110,13 @@ export function getDevelopmentMeta(development: AncaDevelopment): AncaMeta {

if (meta.version == null && packageJson.version != null) {
const version = parseSemver(packageJson.version);
meta.version = {
isPrerelease: version.preRelease != null,
isUnstable: version.major < 1,
text: packageJson.version,
};
if (version) {
meta.version = {
isPrerelease: version.preRelease != null,
isUnstable: version.major < 1,
text: packageJson.version,
};
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/tui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import { fixNodejsTsconfigJson } from "./actions/nodejs-tsconfig.js";
import { fixNodejsTsupConfigJs } from "./actions/nodejs-tsup.js";
import { fixReadmeMd } from "./actions/readme.js";
import cinnabarData from "./cinnabar.js";
import { CINNABAR_PROJECT_VERSION } from "./cinnabar.js";
import { getInstance } from "./config.js";
import {
getDevelopmentDisplayName,
Expand All @@ -48,7 +48,7 @@ interface ClivoAction {
label: string;
}

const APP_NAME_AND_VERSION = `${cinnabarData.name.toLocaleUpperCase()} v${cinnabarData.version.text}`;
const APP_NAME_AND_VERSION = `ANCA v${CINNABAR_PROJECT_VERSION}`;

/**
*
Expand Down

0 comments on commit 6f554e5

Please sign in to comment.