feat(cli): upgrade new project template to yarn3
This commit is contained in:
parent
2e7f3affe1
commit
8f6a10c89a
4 changed files with 60 additions and 29 deletions
|
@ -186,5 +186,13 @@ $RECYCLE.BIN/
|
||||||
/target
|
/target
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
|
||||||
|
.pnp.*
|
||||||
|
.yarn/*
|
||||||
|
!.yarn/patches
|
||||||
|
!.yarn/plugins
|
||||||
|
!.yarn/releases
|
||||||
|
!.yarn/sdks
|
||||||
|
!.yarn/versions
|
||||||
|
|
||||||
*.node
|
*.node
|
||||||
`
|
`
|
||||||
|
|
|
@ -30,20 +30,17 @@ jobs:
|
||||||
settings:
|
settings:
|
||||||
- host: macos-latest
|
- host: macos-latest
|
||||||
target: 'x86_64-apple-darwin'
|
target: 'x86_64-apple-darwin'
|
||||||
architecture: 'x64'
|
|
||||||
build: |
|
build: |
|
||||||
yarn build
|
yarn build
|
||||||
strip -x *.node
|
strip -x *.node
|
||||||
- host: windows-latest
|
- host: windows-latest
|
||||||
build: yarn build
|
build: yarn build
|
||||||
target: 'x86_64-pc-windows-msvc'
|
target: 'x86_64-pc-windows-msvc'
|
||||||
architecture: 'x64'
|
|
||||||
- host: windows-latest
|
- host: windows-latest
|
||||||
build: |
|
build: |
|
||||||
yarn build --target i686-pc-windows-msvc
|
yarn build --target i686-pc-windows-msvc
|
||||||
yarn test
|
yarn test
|
||||||
target: 'i686-pc-windows-msvc'
|
target: 'i686-pc-windows-msvc'
|
||||||
architecture: 'x86'
|
|
||||||
- host: ubuntu-latest
|
- host: ubuntu-latest
|
||||||
target: 'x86_64-unknown-linux-gnu'
|
target: 'x86_64-unknown-linux-gnu'
|
||||||
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
|
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
|
||||||
|
@ -76,7 +73,6 @@ jobs:
|
||||||
yarn build --target aarch64-unknown-linux-gnu &&\n
|
yarn build --target aarch64-unknown-linux-gnu &&\n
|
||||||
aarch64-unknown-linux-gnu-strip *.node
|
aarch64-unknown-linux-gnu-strip *.node
|
||||||
- host: ubuntu-latest
|
- host: ubuntu-latest
|
||||||
architecture: 'x64'
|
|
||||||
target: 'armv7-unknown-linux-gnueabihf'
|
target: 'armv7-unknown-linux-gnueabihf'
|
||||||
setup: |
|
setup: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
@ -85,7 +81,6 @@ jobs:
|
||||||
yarn build --target=armv7-unknown-linux-gnueabihf
|
yarn build --target=armv7-unknown-linux-gnueabihf
|
||||||
arm-linux-gnueabihf-strip *.node
|
arm-linux-gnueabihf-strip *.node
|
||||||
- host: ubuntu-latest
|
- host: ubuntu-latest
|
||||||
architecture: 'x64'
|
|
||||||
target: 'aarch64-linux-android'
|
target: 'aarch64-linux-android'
|
||||||
build: |
|
build: |
|
||||||
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
|
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
|
||||||
|
@ -93,9 +88,8 @@ jobs:
|
||||||
export CXX="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
|
export CXX="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
|
||||||
export PATH="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:\${PATH}"
|
export PATH="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:\${PATH}"
|
||||||
yarn build --target aarch64-linux-android
|
yarn build --target aarch64-linux-android
|
||||||
\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip *.node
|
\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
|
||||||
- host: ubuntu-latest
|
- host: ubuntu-latest
|
||||||
architecture: 'x64'
|
|
||||||
target: 'armv7-linux-androideabi'
|
target: 'armv7-linux-androideabi'
|
||||||
build: |
|
build: |
|
||||||
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
|
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
|
||||||
|
@ -103,9 +97,8 @@ jobs:
|
||||||
export CXX="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
|
export CXX="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
|
||||||
export PATH="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:\${PATH}"
|
export PATH="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:\${PATH}"
|
||||||
yarn build --target armv7-linux-androideabi
|
yarn build --target armv7-linux-androideabi
|
||||||
\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip *.node
|
\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
|
||||||
- host: ubuntu-latest
|
- host: ubuntu-latest
|
||||||
architecture: 'x64'
|
|
||||||
target: 'aarch64-unknown-linux-musl'
|
target: 'aarch64-unknown-linux-musl'
|
||||||
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||||
build: >-
|
build: >-
|
||||||
|
@ -114,7 +107,6 @@ jobs:
|
||||||
yarn build --target aarch64-unknown-linux-musl &&\n
|
yarn build --target aarch64-unknown-linux-musl &&\n
|
||||||
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
|
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
|
||||||
- host: windows-latest
|
- host: windows-latest
|
||||||
architecture: 'x64'
|
|
||||||
target: 'aarch64-pc-windows-msvc'
|
target: 'aarch64-pc-windows-msvc'
|
||||||
build: yarn build --target aarch64-pc-windows-msvc
|
build: yarn build --target aarch64-pc-windows-msvc
|
||||||
|
|
||||||
|
@ -131,7 +123,6 @@ jobs:
|
||||||
node-version: 16
|
node-version: 16
|
||||||
check-latest: true
|
check-latest: true
|
||||||
cache: yarn
|
cache: yarn
|
||||||
architecture: \${{ matrix.settings.architecture }}
|
|
||||||
|
|
||||||
- name: Install
|
- name: Install
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
|
@ -158,7 +149,7 @@ jobs:
|
||||||
- name: Cache NPM dependencies
|
- name: Cache NPM dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: .yarn/cache
|
||||||
key: npm-cache-build-\${{ matrix.settings.target }}-node@16
|
key: npm-cache-build-\${{ matrix.settings.target }}-node@16
|
||||||
|
|
||||||
- name: Setup toolchain
|
- name: Setup toolchain
|
||||||
|
@ -166,8 +157,22 @@ jobs:
|
||||||
if: \${{ matrix.settings.setup }}
|
if: \${{ matrix.settings.setup }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- name: Setup node x86
|
||||||
|
if: matrix.settings.target == 'i686-pc-windows-msvc'
|
||||||
|
run: yarn config set supportedArchitectures.cpu "ia32"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: 'Install dependencies'
|
- name: 'Install dependencies'
|
||||||
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
run: yarn install
|
||||||
|
|
||||||
|
- name: Setup node x86
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
if: matrix.settings.target == 'i686-pc-windows-msvc'
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
architecture: x86
|
||||||
|
|
||||||
- name: Build in docker
|
- name: Build in docker
|
||||||
uses: addnab/docker-run-action@v3
|
uses: addnab/docker-run-action@v3
|
||||||
|
@ -226,7 +231,7 @@ jobs:
|
||||||
whoami
|
whoami
|
||||||
env
|
env
|
||||||
freebsd-version
|
freebsd-version
|
||||||
yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
yarn install
|
||||||
yarn build
|
yarn build
|
||||||
strip -x *.node
|
strip -x *.node
|
||||||
yarn test
|
yarn test
|
||||||
|
@ -267,11 +272,11 @@ jobs:
|
||||||
- name: Cache NPM dependencies
|
- name: Cache NPM dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: .yarn/cache
|
||||||
key: npm-cache-test-\${{ matrix.settings.target }}-\${{ matrix.node }}-\${{ hashFiles('yarn.lock') }}
|
key: npm-cache-test-\${{ matrix.settings.target }}-\${{ matrix.node }}-\${{ hashFiles('yarn.lock') }}
|
||||||
|
|
||||||
- name: 'Install dependencies'
|
- name: 'Install dependencies'
|
||||||
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
run: yarn install
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
@ -309,11 +314,11 @@ jobs:
|
||||||
- name: Cache NPM dependencies
|
- name: Cache NPM dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: .yarn/cache
|
||||||
key: npm-cache-test-linux-x64-gnu-\${{ matrix.node }}
|
key: npm-cache-test-linux-x64-gnu-\${{ matrix.node }}
|
||||||
|
|
||||||
- name: 'Install dependencies'
|
- name: 'Install dependencies'
|
||||||
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
run: yarn install
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
@ -351,11 +356,13 @@ jobs:
|
||||||
- name: Cache NPM dependencies
|
- name: Cache NPM dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: .yarn/cache
|
||||||
key: npm-cache-test-x86_64-unknown-linux-musl-\${{ matrix.node }}
|
key: npm-cache-test-x86_64-unknown-linux-musl-\${{ matrix.node }}
|
||||||
|
|
||||||
- name: 'Install dependencies'
|
- name: 'Install dependencies'
|
||||||
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
run: |
|
||||||
|
yarn config set supportedArchitectures.libc "musl"
|
||||||
|
yarn install
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
@ -398,11 +405,14 @@ jobs:
|
||||||
- name: Cache NPM dependencies
|
- name: Cache NPM dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: .yarn/cache
|
||||||
key: npm-cache-test-linux-aarch64-gnu-\${{ matrix.node }}
|
key: npm-cache-test-linux-aarch64-gnu-\${{ matrix.node }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
run: |
|
||||||
|
yarn config set supportedArchitectures.cpu "arm64"
|
||||||
|
yarn config set supportedArchitectures.libc "glibc"
|
||||||
|
yarn install
|
||||||
|
|
||||||
- name: Setup and run tests
|
- name: Setup and run tests
|
||||||
uses: addnab/docker-run-action@v3
|
uses: addnab/docker-run-action@v3
|
||||||
|
@ -439,11 +449,14 @@ jobs:
|
||||||
- name: Cache NPM dependencies
|
- name: Cache NPM dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: .yarn/cache
|
||||||
key: npm-cache-test-linux-aarch64-musl-\${{ matrix.node }}
|
key: npm-cache-test-linux-aarch64-musl-\${{ matrix.node }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
run: |
|
||||||
|
yarn config set supportedArchitectures.cpu "arm64"
|
||||||
|
yarn config set supportedArchitectures.libc "musl"
|
||||||
|
yarn install
|
||||||
|
|
||||||
- name: Setup and run tests
|
- name: Setup and run tests
|
||||||
uses: addnab/docker-run-action@v3
|
uses: addnab/docker-run-action@v3
|
||||||
|
@ -483,11 +496,13 @@ jobs:
|
||||||
- name: Cache NPM dependencies
|
- name: Cache NPM dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: .yarn/cache
|
||||||
key: npm-cache-test-linux-arm-gnueabihf-\${{ matrix.node }}
|
key: npm-cache-test-linux-arm-gnueabihf-\${{ matrix.node }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
run: |
|
||||||
|
yarn config set supportedArchitectures.cpu "arm"
|
||||||
|
yarn install
|
||||||
|
|
||||||
- name: Setup and run tests
|
- name: Setup and run tests
|
||||||
uses: addnab/docker-run-action@v3
|
uses: addnab/docker-run-action@v3
|
||||||
|
@ -524,10 +539,10 @@ jobs:
|
||||||
- name: Cache NPM dependencies
|
- name: Cache NPM dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: .yarn/cache
|
||||||
key: npm-cache-ubuntu-latest-publish
|
key: npm-cache-ubuntu-latest-publish
|
||||||
- name: 'Install dependencies'
|
- name: 'Install dependencies'
|
||||||
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
run: yarn install
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
|
|
@ -8,6 +8,7 @@ import inquirer, { prompt } from 'inquirer'
|
||||||
import { CreateNpmDirCommand } from '../create-npm-dir'
|
import { CreateNpmDirCommand } from '../create-npm-dir'
|
||||||
import { debugFactory } from '../debug'
|
import { debugFactory } from '../debug'
|
||||||
import { DefaultPlatforms } from '../parse-triple'
|
import { DefaultPlatforms } from '../parse-triple'
|
||||||
|
import { spawn } from '../spawn'
|
||||||
|
|
||||||
import { GitIgnore } from './.gitignore-template'
|
import { GitIgnore } from './.gitignore-template'
|
||||||
import { createCargoContent } from './cargo'
|
import { createCargoContent } from './cargo'
|
||||||
|
@ -202,6 +203,13 @@ edition = "2021"
|
||||||
`,
|
`,
|
||||||
)
|
)
|
||||||
this.writeFile('.gitignore', GitIgnore)
|
this.writeFile('.gitignore', GitIgnore)
|
||||||
|
this.writeFile('.yarnrc.yml', 'nodeLinker: node-modules')
|
||||||
|
await spawn(`yarn set version stable`, {
|
||||||
|
cwd: join(process.cwd(), this.dirname!),
|
||||||
|
})
|
||||||
|
await spawn(`yarn install`, {
|
||||||
|
cwd: join(process.cwd(), this.dirname!),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private writeFile(path: string, content: string) {
|
private writeFile(path: string, content: string) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ export const createPackageJson = (
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
devDependencies: {
|
devDependencies: {
|
||||||
'@napi-rs/cli': `^${version}`,
|
'@napi-rs/cli': `^${version}`,
|
||||||
ava: '^4.2.0',
|
ava: '^4.3.0',
|
||||||
},
|
},
|
||||||
engines: {
|
engines: {
|
||||||
node: '>= 10',
|
node: '>= 10',
|
||||||
|
|
Loading…
Reference in a new issue