Skip to content

Commit

Permalink
feat: Migrate to NPM package manager (#16754)
Browse files Browse the repository at this point in the history
- updated all yarn references to npm counterparts of the cli commands
- removed yarn lock for package lock
- update tools, scripts, builds to use npm


closes https://jira.tools.sap/browse/CXSPA-1977
  • Loading branch information
pawelfras authored Feb 21, 2023
1 parent de9fb5c commit d372148
Show file tree
Hide file tree
Showing 105 changed files with 49,421 additions and 17,856 deletions.
6 changes: 3 additions & 3 deletions .github/api-extractor-action/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM node:16

COPY package.json /
COPY yarn.lock /
COPY package-lock.json /

RUN yarn
RUN npm i

COPY src/*.ts /
COPY tsconfig.json /

RUN ["yarn", "build"]
RUN ["npm", "run", "build"]

ENTRYPOINT ["node", "/index.js"]
1,529 changes: 1,529 additions & 0 deletions .github/api-extractor-action/package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions .github/api-extractor-action/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function prepareRepositoryForApiExtractor(
core.startGroup('Prepare branches for extractor');

// Install dependencies to build libraries
await exec.exec('yarn');
await exec.exec('npm', ['i']);
// Create directory for reports
await io.mkdirP(`${REPORT_DIR}`);

Expand Down Expand Up @@ -60,14 +60,14 @@ export async function prepareRepositoryForApiExtractor(
);

// If we didn't restore builded libs from cache on the BASE branch, we need to also build base branch
await exec.exec('yarn', ['--cwd', BASE_BRANCH_DIR]);
await exec.exec('yarn', ['--cwd', BASE_BRANCH_DIR, BUILD_COMMAND]);
await exec.exec('npm', ['--prefix', BASE_BRANCH_DIR]);
await exec.exec('npm', ['--prefix', BASE_BRANCH_DIR, 'run', BUILD_COMMAND]);
}

// Build the libraries from the HEAD branch
// TODO: We can parallel these builds, when schematics builds won't trigger yarn install
await exec.exec('yarn');
await exec.exec('yarn', [BUILD_COMMAND]);
// TODO: We can parallel these builds, when schematics builds won't trigger npm install
await exec.exec('npm', ['i']);
await exec.exec('npm', ['run', BUILD_COMMAND]);

core.endGroup();
}
594 changes: 0 additions & 594 deletions .github/api-extractor-action/yarn.lock

This file was deleted.

6 changes: 3 additions & 3 deletions .github/cache-builded-libs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM node:16

COPY package.json /
COPY yarn.lock /
COPY package-lock.json /

RUN yarn
RUN npm i

COPY index.ts /
COPY tsconfig.json /

RUN ["yarn", "build"]
RUN ["npm", "run", "build"]

ENTRYPOINT ["node", "/index.js"]
10 changes: 5 additions & 5 deletions .github/cache-builded-libs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import * as exec from '@actions/exec';
import * as github from '@actions/github';

async function run() {
core.startGroup('yarn');
let exitCode = await exec.exec('yarn', [], {
core.startGroup('npm');
let exitCode = await exec.exec('npm', ['i'], {
ignoreReturnCode: true,
});
core.endGroup();
if (exitCode !== 0) {
core.setFailed(`Yarn install failed`);
core.setFailed(`NPM install failed`);
}

core.startGroup('yarn build:libs');
exitCode = await exec.exec('yarn', ['build:libs'], {
core.startGroup('npm run build:libs');
exitCode = await exec.exec('npm', ['run', 'build:libs'], {
ignoreReturnCode: true,
});
core.endGroup();
Expand Down
Loading

0 comments on commit d372148

Please sign in to comment.