Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Setup wercker #7312

Closed
wants to merge 5 commits into from
Closed
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
29 changes: 0 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,29 +321,6 @@ jobs:
- run:
name: Upload coverage
command: yarn coverage
cli-test:
<<: *defaults
environment:
BASH_ENV: ~/.bashrc
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Test
command: yarn test --cli
no_output_timeout: 1800
cli-test-latest-cra:
<<: *defaults
environment:
BASH_ENV: ~/.bashrc
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Test CLI with latest CR(N)A
command: yarn test-latest-cra
workflows:
version: 2
build_test_deploy:
Expand Down Expand Up @@ -373,12 +350,6 @@ workflows:
- coverage:
requires:
- test
- cli-test:
requires:
- build
- cli-test-latest-cra:
requires:
- build
- chromatic:
requires:
- examples
49 changes: 36 additions & 13 deletions lib/cli/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export function installDepsFromPackageJson(options) {
/**
* Add dependencies to a project using `yarn add` or `npm install`.
*
* @param {Object} npmOptions contains `useYarn` and `installAsDevDependencies` which we use to determine how we install packages.
* @param {Object} npmOptions contains `useYarn`, `runInstall` and `installAsDevDependencies` which we use to determine how we install packages.
* @param {Array} dependencies contains a list of packages to add.
* @example
* installDependencies(npmOptions, [
Expand All @@ -192,22 +192,45 @@ export function installDepsFromPackageJson(options) {
* ]);
*/
export function installDependencies(npmOptions, dependencies) {
const spawnCommand = npmOptions.useYarn ? 'yarn' : 'npm';
const installCommand = npmOptions.useYarn ? 'add' : 'install';
const { skipInstall } = npmOptions;

const installArgs = [installCommand, ...dependencies];
if (skipInstall) {
const spawnCommand = 'pkg-add-deps';

if (npmOptions.installAsDevDependencies) {
installArgs.push('-D');
}
const installArgs = dependencies;

const dependencyResult = spawnSync(spawnCommand, installArgs, {
stdio: 'inherit',
});
if (npmOptions.installAsDevDependencies) {
installArgs.push('-D');
}

if (dependencyResult.status !== 0) {
logger.error('An error occurred while installing dependencies.');
process.exit(1);
const dependencyResult = spawnSync(spawnCommand, installArgs, {
stdio: 'inherit',
});

if (dependencyResult.status !== 0) {
logger.error('An error occurred while installing dependencies.');
logger.log(dependencyResult);
process.exit(1);
}
} else {
const spawnCommand = npmOptions.useYarn ? 'yarn' : 'npm';
const installCommand = npmOptions.useYarn ? 'add' : 'install';

const installArgs = [installCommand, ...dependencies];

if (npmOptions.installAsDevDependencies) {
installArgs.push('-D');
}

const dependencyResult = spawnSync(spawnCommand, installArgs, {
stdio: 'inherit',
});

if (dependencyResult.status !== 0) {
logger.error('An error occurred while installing dependencies.');
logger.log(dependencyResult);
process.exit(1);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions lib/cli/lib/initiate.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const installStorybook = (projectType, options) => {
const npmOptions = {
useYarn,
installAsDevDependencies: true,
skipInstall: options.skipInstall,
};

const runStorybookCommand = useYarn ? 'yarn storybook' : 'npm run storybook';
Expand Down
1 change: 1 addition & 0 deletions lib/client-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"core-js": "^3.0.1",
"eventemitter3": "^3.1.0",
"global": "^4.3.2",
"pkg-add-deps": "^0.1.0",
"is-plain-object": "^3.0.0",
"lodash": "^4.17.11",
"memoizerific": "^1.11.3",
Expand Down
23 changes: 23 additions & 0 deletions wercker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
box: node
no-response-timeout: 40

build:
steps:
- script:
name: Install
code: |
yarn install --ignore-scripts --silent --ignore-optional

- script:
name: Bootstrap
code: |
yarn bootstrap --build --dll

- script:
name: CLI tests
code: |
yarn test --cli
- script:
name: latest CRA test
code: |
yarn test-latest-cra
Loading