Code Monkey home page Code Monkey logo

create-aio-lib's Introduction

oclif Version Downloads/week Build Status License License Codecov Coverage

@adobe/create-aio-lib

CLI tool to create AIO Libs

This uses this template.

Usage (npm)

Make sure you have npm version 6.1.0 or greater:

npm --version

Then run:

npm init @adobe/aio-lib <library_name> <repo_name> [options]

where <library_name> is the name of your library (this will create the folder in the current working directory by default)

Usage (cli)

npx @adobe/create-aio-lib <library_name> <repo_name> [options]

where <library_name> is the name of your library where <repo_name> is the scoped name of your repo

Command

Creates an AIO Lib

USAGE
  $ create-aio-lib LIBNAME REPONAME

ARGUMENTS
  LIBNAME   the name of the library
  REPONAME  the repo of the library

OPTIONS
  -h, --help                     show CLI help

  -o, --outputDir=outputDir      folder to output the library in (defaults to
                                 the current working folder)

  -t, --templateUrl=templateUrl  the template to use

  -v, --version                  show CLI version

  -w, --overwrite                overwrite any existing output folder

DESCRIPTION
  Example:
       create-aio-lib MyLibClass myOrg/myRepo

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

create-aio-lib's People

Contributors

amulyakashyap09 avatar dependabot[bot] avatar greenkeeper[bot] avatar michaelgoberling avatar purplecabbage avatar shazron avatar snyk-bot avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-aio-lib's Issues

An in-range update of eslint is breaking the build 🚨

The devDependency eslint was updated from 6.7.1 to 6.7.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details

Release Notes for v6.7.2
  • bc435a9 Fix: isSpaceBetweenTokens() recognizes spaces in JSXText (fixes #12614) (#12616) (Toru Nagashima)
  • 4928d51 Fix: don't ignore the entry directory (fixes #12604) (#12607) (Toru Nagashima)
  • b41677a Docs: Clarify suggestion's data in Working with Rules (refs #12606) (#12617) (Milos Djermanovic)
  • ea16de4 Fix: Support tagged template literal generics in no-unexpected-multiline (#11698) (Brad Zacher)
  • fa6415d Sponsors: Sync README with website (ESLint Jenkins)
  • e1e158b Sponsors: Sync README with website (ESLint Jenkins)
Commits

The new version differs by 8 commits.

  • dbbba83 6.7.2
  • bc54d15 Build: changelog update for 6.7.2
  • bc435a9 Fix: isSpaceBetweenTokens() recognizes spaces in JSXText (fixes #12614) (#12616)
  • 4928d51 Fix: don't ignore the entry directory (fixes #12604) (#12607)
  • b41677a Docs: Clarify suggestion's data in Working with Rules (refs #12606) (#12617)
  • ea16de4 Fix: Support tagged template literal generics in no-unexpected-multiline (#11698)
  • fa6415d Sponsors: Sync README with website
  • e1e158b Sponsors: Sync README with website

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

create-aio-lib creates a repo with failing unit test (create-aio-lib needs to be released)

Expected Behaviour

Running npm init @adobe/aio-lib ... should result in a working repository with unit tests that succeed.

Actual Behaviour

The unit tests fail with these errors:

> @adobe/[email protected] unit-tests /Users/bmanen/Projects/xx1/MyLibrary
> jest --config test/jest.config.js --maxWorkers=2

 FAIL  test/helpers.test.js
  ● Test suite failed to run

    TypeError: Cannot read property 'bind' of undefined

      at Object.<anonymous> (node_modules/cross-fetch/dist/node-polyfill.js:2:29)
      at Object.<anonymous> (node_modules/swagger-client/lib/http.js:13:1)

 FAIL  test/index.test.js
  ● Test suite failed to run

    TypeError: Cannot read property 'bind' of undefined

      at Object.<anonymous> (node_modules/cross-fetch/dist/node-polyfill.js:2:29)
      at Object.<anonymous> (node_modules/swagger-client/lib/http.js:13:1)

Reproduce Scenario (including but not limited to)

Steps to Reproduce

$ npm init @adobe/aio-lib MyLibrary adobe/library
$ cd MyLibrary
$ npm install && npm run unit-tests

Platform and Version

Node v14.8.0

Root Cause

The problem is fixed in the repository with commit #9 created based on adobe/aio-lib-template#14. However that fix was never released. There are actually quite a few commits since the last release in February: https://github.com/adobe/create-aio-lib/commits/master

An in-range update of @adobe/aio-lib-template is breaking the build 🚨

The dependency @adobe/aio-lib-template was updated from 1.1.2 to 1.2.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@adobe/aio-lib-template is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details

Release Notes for Rename .gitignore and .npmrc
  • Rename .npmrc to npmrc.template c05dd3e
  • Rename .gitignore to gitignore.template a8a79af
  • Update comment 0ca8c93

1.1.2...v1.2.0

Commits

The new version differs by 4 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

overwrite flag not working

Expected Behaviour

Using the --overwrite | -w flag overwrites an existing dest

Actual Behaviour

> create-aio-lib lib-name repo-name
 β€Ί   Error: Destination /Users/jessem/repos/adobe/aio-all/test/sdk-mod-template-test/lib-name exists, use the '--overwrite' flag to 
 β€Ί   overwrite.

> create-aio-lib lib-name repo-name --overwrite
βœ” Copy template
βœ” Copy template
βœ” Remove .git folder
βœ” Read parameters file
βœ” Update package.json
βœ” Replace text
βœ” Cleanup
βœ” Lib created at /Users/jessem/repos/adobe/aio-all/test/sdk-mod-template-test/lib-name
/Users/jessem/repos/adobe/aio-all/create-aio-lib/node_modules/fs-extra/lib/move/move.js:41
    if (destExists) return cb(new Error('dest already exists.'))
                              ^

Error: dest already exists.
    at /Users/jessem/repos/adobe/aio-all/create-aio-lib/node_modules/fs-extra/lib/move/move.js:41:31
    at /Users/jessem/repos/adobe/aio-all/create-aio-lib/node_modules/fs-extra/node_modules/universalify/index.js:22:54

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

Project initialisation fails with error

The example commands (both using npx and npm init) provided in the readme fail with an error.

Expected Behaviour

The repository is generated correctly running code npx @adobe/create-aio-lib AioLibHeadless AEMSnSDevX/aio-lib-headless

Actual Behaviour

The command errors:

➜  code npx @adobe/create-aio-lib AioLibHeadless AEMSnSDevX/aio-lib-headless
βœ– ENOENT: no such file or directory, stat '/Users/hhertach/.npm/_npx/a3f913b00c8e91cb/node_modules/@adobe/create-aio-…
β—Ό Remove .git folder
β—Ό Read parameters file
β—Ό Update package.json
β—Ό Replace text
β—Ό Cleanup
β—Ό Lib Location
/Users/hhertach/.npm/_npx/a3f913b00c8e91cb/node_modules/@oclif/core/lib/errors/index.js:28
        err = new cli_2.CLIError(input, options);
              ^

CLIError: ENOENT: no such file or directory, stat '/Users/hhertach/.npm/_npx/a3f913b00c8e91cb/node_modules/@adobe/create-aio-lib/node_modules/@adobe/aio-lib-template'
    at Object.error (/Users/hhertach/.npm/_npx/a3f913b00c8e91cb/node_modules/@oclif/core/lib/errors/index.js:28:15)
    at CreateAioLibCommand.error (/Users/hhertach/.npm/_npx/a3f913b00c8e91cb/node_modules/@oclif/core/lib/command.js:103:23)
    at /Users/hhertach/.npm/_npx/a3f913b00c8e91cb/node_modules/@adobe/create-aio-lib/src/commands/create.js:99:14
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  oclif: { exit: 2 },
  code: undefined
}

Details

The issue is here:

const from = path.join(__dirname, '../../node_modules/@adobe/aio-lib-template')

This works if create-aio-lib is cloned as a local repository, and therefore has its own node_modules directory containing the template. But it will not work if the template is installed as a peer of create-aio-lib, as it is in the context when running with npx.

Potential Fixes

The code at

const from = path.join(__dirname, '../../node_modules/@adobe/aio-lib-template')
should be changed to use the normal node module resolution process, looking for the module first in the current directory, then the parent etc. I'm not sure if this can be achieved using a built-in, or needs to be implemented from scratch.

As a temporary workaround, I ran npm i @adobe/aio-lib-template in the directory where the CLI tool expected the template to be. Could be added as a workaround to the readme, but long-term, this is not a great solution.

Platform and Version

Mac 12.6, @adobe/[email protected], node v16.14.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.