Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update node to 14 + CI #295

Merged
merged 4 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Have an idea for improving Typewriter? [Submit an issue first](https://github.co
### Build and run locally

```sh
# Use node version defined in .nvmrc
$ nvm use
# Install dependencies
$ yarn
# Test your Typewriter installation by regenerating Typewriter's typewriter client.
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ jobs:
with:
workflow_id: ${{ github.event.workflow.id }}
build-and-test:
name: "Test (Node.js v${{ matrix.node-version }})"
needs: cancel_previous
runs-on: 'ubuntu-latest'
strategy:
matrix:
node-version: [ 14, 16, 18 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install
run: yarn install --frozen-lockfile
- name: Lint
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10
14
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"version": "oclif readme && git add README.md"
},
"engines": {
"node": ">=12.0.0"
"node": ">=14"
},
"keywords": [
"oclif",
Expand Down
10 changes: 5 additions & 5 deletions src/__tests__/commands/__snapshots__/build.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function validateAgainstSchema(message, schema) {
function withTypewriterContext(message) {
return __assign(__assign({}, message), { context: __assign(__assign({}, (message.context || {})), { typewriter: {
language: 'typescript',
version: '8.0.10',

} }) });
}
/**
Expand Down Expand Up @@ -5363,7 +5363,7 @@ function withTypewriterContext(message: Options = {}): Options {
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.10',

},
},
};
Expand Down Expand Up @@ -6892,7 +6892,7 @@ function withTypewriterContext<P, T extends TrackMessage<P>>(
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.10',

},
},
}
Expand Down Expand Up @@ -8466,7 +8466,7 @@ function withTypewriterContext<P, T extends TrackMessage<P>>(
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.10',

},
},
}
Expand Down Expand Up @@ -10001,7 +10001,7 @@ function withTypewriterContext<P, T extends TrackMessage<P>>(
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.10',

},
},
}
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/commands/__snapshots__/production.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ function withTypewriterContext(message: Options = {}): Options {
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.10',

},
},
};
Expand Down Expand Up @@ -2322,7 +2322,7 @@ function withTypewriterContext<P, T extends TrackMessage<P>>(
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.10',

},
},
}
Expand Down
7 changes: 4 additions & 3 deletions src/__tests__/commands/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ describe("build", () => {
legacyId
);
const { stdout } = await run(["build", "-c", testPath]);
expect(
fs.readFileSync(path.join(testPath, filename), {
const output = fs
.readFileSync(path.join(testPath, filename), {
encoding: "utf-8",
})
).toMatchSnapshot();
.replace(/version:.*\d.*/g, "");
expect(output).toMatchSnapshot();
});
}
});
11 changes: 6 additions & 5 deletions src/__tests__/commands/production.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ describe("prod", () => {
legacyId
);
await run(["production", "-c", testPath]);
expect(
fs.readFileSync(path.join(testPath, filename), {
encoding: "utf-8",
})
).toMatchSnapshot();
const output = fs
.readFileSync(path.join(testPath, filename), {
encoding: "utf-8",
})
.replace(/version:.*\d.*/g, "")
expect(output).toMatchSnapshot();
});
}
});
17 changes: 10 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
{
"compilerOptions": {
"declaration": true,
"allowSyntheticDefaultImports": true,
// https://www.npmjs.com/package/@tsconfig/node14
"lib": ["es2020"],
"module": "commonjs",
"target": "es2020",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",

"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"importHelpers": true,
"moduleResolution": "node",
"outDir": "dist",
"rootDir": "src",
"module": "CommonJS",
"strict": true,
"target": "es2019",
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["src/languages/templates/**/*"]
Expand Down