-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ahmad Nassri
committed
Oct 14, 2018
0 parents
commit 7868ff8
Showing
33 changed files
with
2,347 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@telus/eslint-config" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
repository: | ||
name: create-library | ||
description: an opinionated npm package initializer | ||
topics: init,npm,create,initializer | ||
homepage: https://telus.com/digital | ||
private: false | ||
has_issues: true | ||
has_wiki: false | ||
has_downloads: false | ||
has_projects: false | ||
default_branch: master | ||
allow_squash_merge: true | ||
allow_merge_commit: false | ||
allow_rebase_merge: true | ||
|
||
teams: | ||
- name: architecture-support | ||
permission: admin | ||
|
||
branches: | ||
- name: master | ||
protection: | ||
required_pull_request_reviews: | ||
required_approving_review_count: 1 | ||
dismiss_stale_reviews: true | ||
require_code_owner_reviews: true | ||
dismissal_restrictions: | ||
users: [] | ||
teams: | ||
- architecture-support | ||
|
||
required_status_checks: | ||
strict: true | ||
contexts: | ||
- 'ci/circleci: Build Error' | ||
|
||
enforce_admins: true | ||
|
||
restrictions: | ||
users: [] | ||
teams: | ||
- architecture-support | ||
|
||
labels: | ||
- name: bug | ||
description: Something isn't working | ||
color: EE3F46 | ||
|
||
- name: security | ||
description: Security related topic | ||
color: EE3F46 | ||
|
||
- name: chore | ||
description: Changes that don't modify core files | ||
color: FEF2C0 | ||
|
||
- name: discussion | ||
description: A discussion thread | ||
color: CC317C | ||
|
||
- name: question | ||
description: Generic question | ||
color: CC317C | ||
|
||
- name: enhancement | ||
description: New feature or request | ||
color: 5EBEFF | ||
|
||
- name: optimizaiton | ||
description: Performance or Code Optimization | ||
color: 5EBEFF | ||
|
||
- name: feature | ||
description: New Feature | ||
color: 91CA55 | ||
|
||
- name: in progress | ||
description: Currently being worked on | ||
color: FBCA04 | ||
|
||
- name: watchlist | ||
description: Keep an eye on these | ||
color: FBCA04 | ||
|
||
- name: invalid | ||
description: Something doesn't seem right | ||
color: D2DAE1 | ||
|
||
- name: wontfix | ||
description: This will not be worked on | ||
color: D2DAE1 | ||
|
||
- name: duplicate | ||
description: This issue or pull request already exists | ||
color: D2DAE1 | ||
|
||
- name: on hold | ||
description: No work planned on this for now | ||
color: D2DAE1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.log | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
access=public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@telus/semantic-release-config" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"plugins": [ | ||
"@telus/remark-preset-lint-markdown" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 TELUS Telecommunications Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# NPM Library Initializer | ||
|
||
[![version][npm-image]][npm-url] [![Build Status][circle-image]][circle-url] | ||
|
||
> an opinionated [npm package initializer][npm/init] | ||
## Requirements | ||
|
||
- `npm >= 6.x` | ||
- `node >= 8.*` | ||
|
||
## Usage | ||
|
||
```bash | ||
npm init @telus/library | ||
``` | ||
|
||
## How does this work? | ||
|
||
> _`npm init <initializer>` can be used to set up a new or existing npm package._ | ||
> _`initializer` in this case is an npm package named `create-<initializer>`, which will be installed by `npx`, and then have its main bin executed -- presumably creating or updating `package.json` and running any other initialization-related operations._ | ||
> _[— Source: `docs.npmjs.com`][npm/init]_ | ||
--- | ||
> Github: [@telus](https://github.com/telus) • | ||
> Twitter: [@telusdigital](https://twitter.com/telusdigital) | ||
[circle-url]: https://circleci.com/gh/telus/create-library | ||
[circle-image]: https://img.shields.io/circleci/project/github/telus/create-library/master.svg?style=for-the-badge&logo=circleci | ||
|
||
[npm-url]: https://www.npmjs.com/package/@telus/create-library | ||
[npm-image]: https://img.shields.io/npm/v/@telus/create-library.svg?style=for-the-badge&logo=npm | ||
|
||
[npm/init]: https://docs.npmjs.com/cli/init#description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
app: | ||
working_directory: ~/src | ||
|
||
docker: | ||
- image: telusops/build-essential:latest | ||
|
||
commands: | ||
persist: | ||
steps: | ||
- persist_to_workspace: { root: ~/src, paths: . } | ||
|
||
attach: | ||
steps: | ||
- attach_workspace: { at: "." } | ||
|
||
install: | ||
steps: | ||
- run: | ||
name: Install dependencies | ||
command: npm ci | ||
|
||
jobs: | ||
build: | ||
executor: app | ||
steps: | ||
- checkout | ||
- install | ||
- persist | ||
|
||
lint: | ||
executor: app | ||
steps: | ||
- attach | ||
- run: npm run lint | ||
|
||
release: | ||
executor: app | ||
steps: | ||
- attach | ||
- run: npx semantic-release | ||
|
||
workflows: | ||
version: 2 | ||
run: | ||
jobs: | ||
- build: | ||
context: npm-library | ||
|
||
- lint: | ||
requires: [ build ] | ||
|
||
- release: | ||
context: npm-library | ||
requires: [ build, lint ] | ||
filters: | ||
branches: | ||
only: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env node | ||
const yargs = require('yargs') | ||
const template = require('./lib/template') | ||
|
||
const builder = () => { | ||
yargs.positional('path', { | ||
describe: 'path to initialize project in', | ||
type: 'string', | ||
default: '.' | ||
}) | ||
} | ||
|
||
/* eslint-disable no-unused-expressions */ | ||
yargs | ||
.command('$0 [path]', 'initiate a new project', builder, template) | ||
.argv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const spdx = require('spdx-license-list/full') | ||
|
||
const unlicensed = [{ | ||
name: 'UNLICENSED', | ||
value: { | ||
key: 'UNLICENSED', | ||
name: 'UNLICENSED', | ||
licenseText: '(c) Copyright <year> TELUS Telecommunications Inc. all rights reserved' | ||
} | ||
}] | ||
|
||
const approved = ['ISC', 'AGPL-3.0-only', 'AGPL-3.0-or-later', 'Apache-2.0', 'GPL-3.0-only', 'GPL-3.0-or-later', 'LGPL-3.0-only', 'LGPL-3.0-or-later', 'MIT'] | ||
|
||
const opensource = Object.entries(spdx) | ||
// only use approved licenses | ||
.filter(([key]) => approved.includes(key)) | ||
|
||
// structure objects for use with `inquirer` | ||
.map(([key, value]) => ({ name: value.name, value: Object.assign({ key }, value) })) | ||
|
||
module.exports = unlicensed.concat(opensource) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const inquirer = require('inquirer') | ||
const name = require('validate-npm-package-name') | ||
|
||
const licenses = require('./licenses') | ||
|
||
// validation helpers | ||
const validate = { | ||
notEmpty: input => input && input.length > 0, | ||
name: input => name(input).validForNewPackages | ||
} | ||
|
||
// the actual questions | ||
module.exports = pkg => inquirer.prompt([ | ||
{ | ||
type: 'confirm', | ||
name: 'oss', | ||
message: 'is this an open source project?', | ||
default: false | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'title', | ||
message: 'project title', | ||
filter: input => input.trim(), | ||
validate: validate.notEmpty | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'description', | ||
message: 'project description', | ||
default: pkg.description, | ||
filter: input => input.trim(), | ||
validate: validate.notEmpty | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'name', | ||
message: 'package/repo name', | ||
default: answers => (pkg.name ? pkg.name.replace(/@.+\//, '') : answers.title.toLowerCase().replace(/[\W_]+/g, '-')), | ||
filter: input => input.trim(), | ||
validate: validate.name | ||
}, | ||
{ | ||
type: 'list', | ||
name: 'license', | ||
message: 'choose a license', | ||
choices: licenses, | ||
default: answers => pkg.license || (answers.oss ? 'MIT' : 'UNLICENSED') | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'topics', | ||
message: 'keywords to use (comma separated)', | ||
default: pkg.keywords ? pkg.keywords.filter(keyword => keyword !== 'telus').join(', ') : null, | ||
filter: input => input.trim().split(',').map(keyword => keyword.trim()), | ||
validate: validate.notEmpty | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'team', | ||
message: 'maintainers (github team slug)', | ||
validate: input => validate.notEmpty(input) && !/[^a-z-]/g.test(input) | ||
} | ||
]) |
Oops, something went wrong.