Skip to content

Commit

Permalink
chore(monorepo): initial commit to create the create-pkg monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
rxmarbles committed Jan 19, 2024
1 parent 7e31a87 commit 94635b0
Show file tree
Hide file tree
Showing 27 changed files with 211 additions and 124 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- directory: /
package-ecosystem: github-actions
rebase-strategy: auto
schedule:
interval: daily
- directory: /
package-ecosystem: npm
rebase-strategy: auto
schedule:
interval: daily
1 change: 1 addition & 0 deletions .github/workflows/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @wesleytodd @rxmarbles
32 changes: 32 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'

jobs:
ci:
strategy:
matrix:
node-version:
- '18'
- '20'
- '21'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: 'package-lock.json'
- name: Install Deps
run: npm ci
- name: Run Tests
run: npm test

2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package-lock=false
registry=https://registry.npmjs.org
84 changes: 2 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,3 @@
# Scaffold a Package
# Create PKG

[![NPM Version](https://img.shields.io/npm/v/create-pkg.svg)](https://npmjs.org/package/create-pkg)
[![NPM Downloads](https://img.shields.io/npm/dm/create-pkg.svg)](https://npmjs.org/package/create-pkg)
[![test](https://github.com/pkgjs/create/workflows/Test/badge.svg)](https://github.com/pkgjs/create/actions?query=workflow%3ATest)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard)

## Usage

```
$ npm init pkg
# or
$ npx create-pkg
# or
$ npm install -g create-pkg
$ create-pkg
```

### CLI Usage

```
$ create-pkg --help
create-git
initalize a package
Options:
--help Show help [boolean]
--version Show version number [boolean]
--cwd, -d Directory to run in [default: process.cwd()]
# TODO
```

### Programmatic Usage

```javascript
const createPkg = require('@pkgjs/create-pkg')

await createPkg({
// TODO
})
```

#### Composition with other `create-*` packages

This generator is built on top of `opta`, a helper library for collecting
user input from multiple interfaces: CLI via `yargs`, interactive prompts via `inquirer`
and via a JS interface. To compose with other `opta` based input collection,
you can use `.options` to access the cli/prompt/js configurations.

```javascript
const createPkg = require('create-pkg')
const opta = require('opta')

const opts = opta({
commandDescription: 'Your description',
options: {
// Spread the options from createGPkg
...createPkg.options,
}
})

// Our generator main
module.exports = async function (input) {
// Add our input as overrides on the opta instance
options.overrides(input)

// Prompt the user,
await options.prompt()

// Get the current values from the opta instance
let opts = options.values()

// Call create git
await createPkg(opts)
}
```

For more information check out the [docs for `opta`](https://www.npmjs.com/package/opta).
TODO: Add specificities here
56 changes: 15 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,21 @@
{
"name": "create-pkg",
"version": "0.0.0",
"description": "Scaffold a package",
"author": "Wes Todd <[email protected]>",
"keywords": [
"scaffold",
"package",
"git",
"module",
"package.json",
"readme",
"mocha",
"standard"
],
"license": "ISC",
"main": "index.js",
"repository": {
"type": "git",
"url": "[email protected]:pkgjs/create.git"
},
"bin": {
"create-package": "bin/create-package"
},
"name": "create-pkg-monorepo",
"version": "1.0.0",
"description": "The mono-repo for all create-pkg packages",
"scripts": {
"test": "standard && mocha --timeout=60000",
"test:debug": "mocha --inspect --inspect-brk --timeout=0",
"release": "npm t && standard-version && npm publish",
"postpublish": "git push origin && git push origin --tags"
"test": "npm test -ws --if-present"
},
"dependencies": {
"cptmpl": "0.0.5",
"create-git": "^1.0.0-2",
"create-package-json": "^1.0.0-2",
"loggerr": "^3.0.0-3",
"opta": "0.0.6",
"semver": "^7.3.2"
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/pkgjs/create-pkg.git"
},
"devDependencies": {
"fs-extra": "^8.0.1",
"fs-test-fixtures": "^0.1.3",
"mocha": "^6.2.2",
"standard": "^14.3.1",
"standard-version": "^9.0.0"
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/pkgjs/create-pkg/issues"
},
"support": true
"homepage": "https://github.com/pkgjs/create-pkg#readme",
"workspaces": [
"packages/*"
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
83 changes: 83 additions & 0 deletions packages/create-pkg-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Scaffold a Package

[![NPM Version](https://img.shields.io/npm/v/create-pkg.svg)](https://npmjs.org/package/create-pkg)
[![NPM Downloads](https://img.shields.io/npm/dm/create-pkg.svg)](https://npmjs.org/package/create-pkg)
[![test](https://github.com/pkgjs/create/workflows/Test/badge.svg)](https://github.com/pkgjs/create/actions?query=workflow%3ATest)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard)

## Usage

```
$ npm init pkg
# or
$ npx create-pkg
# or
$ npm install -g create-pkg
$ create-pkg
```

### CLI Usage

```
$ create-pkg --help
create-git
initalize a package
Options:
--help Show help [boolean]
--version Show version number [boolean]
--cwd, -d Directory to run in [default: process.cwd()]
# TODO
```

### Programmatic Usage

```javascript
const createPkg = require('@pkgjs/create-pkg')

await createPkg({
// TODO
})
```

#### Composition with other `create-*` packages

This generator is built on top of `opta`, a helper library for collecting
user input from multiple interfaces: CLI via `yargs`, interactive prompts via `inquirer`
and via a JS interface. To compose with other `opta` based input collection,
you can use `.options` to access the cli/prompt/js configurations.

```javascript
const createPkg = require('create-pkg')
const opta = require('opta')

const opts = opta({
commandDescription: 'Your description',
options: {
// Spread the options from createGPkg
...createPkg.options,
}
})

// Our generator main
module.exports = async function (input) {
// Add our input as overrides on the opta instance
options.overrides(input)

// Prompt the user,
await options.prompt()

// Get the current values from the opta instance
let opts = options.values()

// Call create git
await createPkg(opts)
}
```

For more information check out the [docs for `opta`](https://www.npmjs.com/package/opta).
File renamed without changes.
File renamed without changes.
File renamed without changes.
47 changes: 47 additions & 0 deletions packages/create-pkg-cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "create-pkg",
"version": "0.0.0",
"description": "Scaffold a package",
"author": "Wes Todd <[email protected]>",
"keywords": [
"scaffold",
"package",
"git",
"module",
"package.json",
"readme",
"mocha",
"standard"
],
"license": "ISC",
"main": "index.js",
"repository": {
"type": "git",
"url": "[email protected]:pkgjs/create.git"
},
"bin": {
"create-package": "bin/create-package"
},
"scripts": {
"test": "standard && mocha --timeout=60000",
"test:debug": "mocha --inspect --inspect-brk --timeout=0",
"release": "npm t && standard-version && npm publish",
"postpublish": "git push origin && git push origin --tags"
},
"dependencies": {
"cptmpl": "0.0.5",
"create-git": "^1.0.0-2",
"create-package-json": "^1.0.0-2",
"loggerr": "^3.0.0-3",
"opta": "0.0.6",
"semver": "^7.3.2"
},
"devDependencies": {
"fs-extra": "^8.0.1",
"fs-test-fixtures": "^0.1.3",
"mocha": "^6.2.2",
"standard": "^14.3.1",
"standard-version": "^9.0.0"
},
"support": true
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/create-pkg-cli/templates/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions packages/create-pkg-cli/test/tmp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# tmp

[![NPM Version](https://img.shields.io/npm/v/tmp.svg)](https://npmjs.org/package/tmp)
[![NPM Downloads](https://img.shields.io/npm/dm/tmp.svg)](https://npmjs.org/package/tmp)
[![test](https://github.com/pkgjs/__tmp/workflows/Test/badge.svg)](https://github.com/pkgjs/__tmp/actions?query=workflow%3ATest)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard)



```
$ npm i tmp
```
5 changes: 5 additions & 0 deletions packages/create-pkg-cli/test/tmp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict'

module.exports = function () {
return 'Hello World'
}

0 comments on commit 94635b0

Please sign in to comment.