Skip to content

Commit

Permalink
fix: fixing example publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 27, 2018
1 parent 6a1c3df commit d03efe7
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 60 deletions.
17 changes: 0 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@ jobs:
- run: .circleci/setup_git
- run: ./node_modules/.bin/nps release

example-multi-cli-typescript: &example
<<: *test
steps:
- add_ssh_keys
- checkout
- restore_cache: *restore_cache
- run: .circleci/yarn
- run: .circleci/setup_git
- run: .circleci/release_example

workflows:
version: 2
create-dxcli:
Expand Down Expand Up @@ -154,10 +144,3 @@ workflows:
- node-8-single
- node-8-plugin
- node-8-multi
- example-multi-cli-typescript: &example_workflow
context: org-global
requires:
- release
# - example-multi-cli-javascript: *example_workflow
# - example-single-cli-typescript: *example_workflow
# - example-single-cli-javascript: *example_workflow
95 changes: 52 additions & 43 deletions .circleci/release_example
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,56 @@ sh.set('-ev')

sh.exec('yarn link')
const version = process.args[1]
const example = process.env.CIRCLE_JOB
const [, type,, format] = example.split('-')

const options = format === 'typescript' ?
'--options=typescript,mocha,semantic-release' :
'--options=mocha,semantic-release'

sh.cd(`examples/${example}`)
sh.exec('git fetch')
sh.exec('git checkout master')
sh.exec('git pull --rebase origin master')

sh.rm('-rf', [
'.circleci',
'.editorconfig',
'.eslintignore',
'.eslintrc',
'.gitattributes',
'.gitignore',
'README.md',
'appveyor.yml',
'bin',
'lib',
'package-scripts.js',
'src',
'test',
'tsconfig.json',
'tslint.json',
'yarn.lock',
])

const pjson = fs.readJSONSync('package.json')
fs.outputJSONSync('package.json', {
name: `@dxcli/${example}`,
repository: `dxcli/${example}`,
author: pjson.author,
version: pjson.version,
description: pjson.description,
})

sh.exec(`create-dxcli ${type} --force --defaults ${options}`)
sh.exec('git add -A')
sh.exec(`git commit -m "fix: create-dxcli ${version}"`)
sh.exec('git push')
const examples = [
'example-multi-cli-javascript',
'example-multi-cli-typescript',
'example-single-cli-javascript',
'example-single-cli-typescript',
]

examples.forEach(example => {
const [, type,, format] = example.split('-')

const options = format === 'typescript' ?
'--options=typescript,mocha,semantic-release' :
'--options=mocha,semantic-release'

sh.cd(`examples/${example}`)
sh.exec('git fetch')
sh.exec('git checkout master')
sh.exec('git pull --rebase origin master')

sh.rm('-rf', [
'.circleci',
'.editorconfig',
'.eslintignore',
'.eslintrc',
'.gitattributes',
'.gitignore',
'README.md',
'appveyor.yml',
'bin',
'lib',
'package-scripts.js',
'src',
'test',
'tsconfig.json',
'tslint.json',
'yarn.lock',
])

const pjson = fs.readJSONSync('package.json')
fs.outputJSONSync('package.json', {
name: `@dxcli/${example}`,
repository: `dxcli/${example}`,
author: pjson.author,
version: pjson.version,
description: pjson.description,
})

sh.exec(`create-dxcli ${type} --force --defaults ${options}`)
sh.exec('git add -A')
sh.exec(`git commit -m "fix: create-dxcli ${version}"`)
sh.exec('git push')
})

0 comments on commit d03efe7

Please sign in to comment.