Commit Graph

45 Commits

Author SHA1 Message Date
Andreas Jaeger f57ebca959 Retire js-generator-openstack
This repository is unused, retire it.

Change-Id: Ib6b55e118b7092a05dfe6bcbb6bcb66a8b20fdc2
Depends-On: https://review.openstack.org/597370/
2018-08-29 09:04:51 +02:00
Yujun Zhang 5c9e5bbeaf Remove IIFE in all scripts
It is not required by node.js, but introduce troubles while
generating documents with jsdoc3.

Refer to https://github.com/jsdoc3/jsdoc/issues/456

Change-Id: I6664f1be0fc3e86f3a7e3843d557786c37df1c5e
2016-07-05 16:38:35 +08:00
Yujun Zhang 601a1c21b9 Add default test harness for nodejs projects
story/2000598

Change-Id: I180f887f29bd378992c1c4678832b47e4e2e497f
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
2016-06-15 22:21:18 +08:00
Michael Krotscheck 60a853aa3c Added copyright header.
I didn't add these headers when I initially implemented this
generator.

Change-Id: I852e4e667e3ff14e9dda2e770b30759fdcecca75
2016-06-15 05:33:31 -07:00
Michael Krotscheck f8c932ea8d Created Structure Module
The structure module is a prompt-only module that determines and
sets structural attributes which inform the rest of the project.
With these values, we can automatically generate test configuration
files, sample project layouts, as well as toggle specific tooling
options (such as gulp, karma, and others).

Change-Id: I477f427da121aeda967fadbcbe73d0a75e9d6bed
2016-06-15 05:33:31 -07:00
Michael Krotscheck 57c560e7d5 .gitignore includes files flagged as ignored.
If a file is ignored in the project builder, it is now persisted
into the .gitignore file in the project.

Change-Id: Ic8e5d08b82da5809b1dc2a8427f6563dc9acf00b
2016-06-15 05:33:31 -07:00
Michael Krotscheck 1ee651fd0e .gitignore file is now read and echoed back into the project
This patch allows the generator to read a .gitignore file and
echo it back into the project. This implementation is destructive
of the original format, and can be improved in the future.

Change-Id: I38fb29e564120464406c00586952eee0c19150e1
2016-06-15 05:33:31 -07:00
Michael Krotscheck 0cd80006fd Add nsp to prepublish hook
Nsp is a tool published by the Node Security team, which scans
a project for known and easily recognizable vulnerabilities. For
a list of advisories, please check https://nodesecurity.io/advisories

Change-Id: I554320d0c4aca86184e03aac853a5a4d9f48fcdd
2016-06-15 05:33:31 -07:00
Michael Krotscheck d53c4d6aa6 New projects now conform the the 'npm run lint' CTI spec.
This patch binds 'eslint ./' command to the npm 'lint' script.

Change-Id: I27aa8e7d8d565b5eeb70f1f0c8a58ed21036aa28
2016-06-15 05:33:31 -07:00
Michael Krotscheck b6e9361bf6 Script commands may now be added to a package.
This adds the pkgBuilder.addCommand() method, which permits adding
a command (such as 'eslint':'eslint ./') to the npm scripts list.

Change-Id: I0ebfa9cbc0a526363cd2c8d1a0b697f5748e0771
2016-06-15 05:33:31 -07:00
Michael Krotscheck 4c3e27d6b7 Eslint module now adds eslint and eslint-config-openstack dependencies
This patch ensures that eslint, and eslint-config-openstack, are added
to the project that the most recent managed version.

Change-Id: I8c90bbce96f78080c1fc2f1afc529a97894091cb
2016-06-15 05:33:31 -07:00
Michael Krotscheck 9f17711019 Package builder now adds dependencies
This adds a convenience method to the package.json builder, which
wraps various sanity checks around the process of adding a dependency
to a project.

Change-Id: I111b3d5ead31979933993916d091277c94290d25
2016-06-15 05:33:30 -07:00
Michael Krotscheck f645ce2a9c Dependencies are updated from global deps.
This patch will update any project dependencies with the global
version, if available.

Change-Id: I9ca73951a67bc7d3e6c161a42b42ce7823ace56b
2016-06-15 05:33:25 -07:00
Michael Krotscheck 5c4ae1b51a Package file ignores common node runtime files.
This patch adds common files used by a node runtime environment
to the eslint ignore list.

Change-Id: Idc8dcce68947d3965ddd128180a5260dc5d6e36f
2016-06-14 09:13:53 -07:00
Michael Krotscheck 976c53299c .eslintignore generation includes ignored files from projectBuilder
Any file paths registered as ignored with the project builder are
now also included/appended to the .eslintignore file. Duplicates
are not repeated.

Change-Id: I23aa82f5f94f726862ff5235039a90948755b4f2
2016-06-14 09:13:03 -07:00
Michael Krotscheck aaccbb2d0e Project builder can now ignore files.
This patch adds the ignoreFiles option to the package builder, which
permits us to build a list of paths that should be ignored by our
tools. For example, this can be used to build a .gitignore or an
.eslintignore list.

Change-Id: I5ba67a9dbac1b90b72fb0a7ab1994fd2229e39d0
2016-06-10 06:02:37 -07:00
Yujun Zhang ea2b60a6c8 Fix bug in project name
gerrit project name shall come from

1. user answer if given
2. .gitreview if no answer is given
3. create from package name if .gitreview does not exist

Change-Id: I02eb9e86fd97fc67093e16a4264c24625f7f2e47
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
2016-06-06 23:27:07 +08:00
Yujun Zhang a900c0b670 Swap arguments order of assertion in expectGerritFileContent
What we are checking is `gitreview`. `content` is the expected result.

Change-Id: Ifc3dbf6b2b8e6c91b61793eed8ad7b4398cac09a
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
2016-05-31 15:36:56 +08:00
Michael Krotscheck d6918c50a4
Added global-dependencies library
This library permits reading, validating, and accessing a set of
globally accepted dependency criteria. It will eventually be used
to synchronize dependencies across multiple javascript projects.

Change-Id: I2ec7a218311cfcfc7d33c4a1e29e73ed8e2f7b42
2016-05-20 11:35:59 -07:00
Michael Krotscheck 1292783504
Updated gerrit module
This makes two significant changes to the gerrit module. The first
is that the enableGerrit flag is no longer kept in .yo-rc.json, and
instead is inferred from the existence of a .gitreview file. Secondly,
this patch establishes a default fallback mechanism for project
naming:

1- Check if gitreview already exists.
2- Construct one from the package.json project name.
3- Use the yeoman app name.

Change-Id: I3d559b6655de9621e522429bf2bfac5da9762d07
2016-05-20 11:34:35 -07:00
Michael Krotscheck fd162efb91
Using the --non-interactive flag now force-overwrites files.
If a user applies this flag, no tty input should be required. This
ensures that it works as expected.

Change-Id: I20d00295f7164eec2442f45c91e9f1150bc605a0
2016-05-20 11:33:25 -07:00
Michael Krotscheck 8f01e2447d
Added project detail prompts.
These prompts include things like project name, description,
authors, and homepage, all set with sane defaults.

Change-Id: Ia0f16b517c64953af77dd82829361ab5305f95d8
2016-05-20 11:31:19 -07:00
Michael Krotscheck bc11aa0cb9
Added default value retrieval to pkgBuilder.getValue
This will assist in building generator prompts that return either
the existing value, or a sane default.

Change-Id: I66f47c70ebc529d0a1832677a925083c663adc8c
2016-05-20 11:28:16 -07:00
Michael Krotscheck 36695dd8f8
Corrected unit test in gerrit prompt().
The method was testing the init() method, not the prompt() method.
This corrects the test.

Change-Id: Id26e386aa3d6be0eb7d4778cf068679fec01426b
2016-05-20 11:28:09 -07:00
Michael Krotscheck 43b2171ce4
Consistent function spacing.
This patch applies spaces after anonymous function expressions.
This is consistent with how we lint function declarations.

Change-Id: I9b330673daa632e8d22f0a506e41c9643bb821c7
2016-05-20 10:48:59 -07:00
Michael Krotscheck e8db0834b8
Added value retrieval to package builder.
This patch adds getValues and getValue to the package builder
library, to allow retrieval of package-level variables from an
authoritative source during the various project configuraiton
stages.
2016-05-11 08:24:10 -07:00
Michael Krotscheck 2e40d06226
Moved non-interactive flag into submodules.
There are some situations in which a component should error if
it is set to 'non-interactive', for example if a project name is
needed and none has been configured/detected. This patch moves
the non-interactive flag adjudication into the components, so
that they have the freedom to enable this logic.
2016-05-11 08:24:02 -07:00
Michael Krotscheck 46f08869e6 Created simple package builder
This package builder reads in any existing package.json file,
exposes a set-value method, and then writes it back to the filesystem.
2016-04-04 12:48:16 -07:00
Michael Krotscheck 07cb1d455d Fixed build dependencies
This patch accomplishes the following:
- It updates node security, as this depended on a version
  of ansi-styles that was unpublished.
- It updates deprecated uses of yeoman Base and yeoman test.
- It adds mem-fs and mem-fs-editor to dependencies, as those are
  only transiently available in later versions of node/npm.
2016-04-04 11:39:51 -07:00
Michael Krotscheck 1e679bc680 Wrapped all modules into a promise chain
In order to ensure that submodules can perform asynchronous actions,
we've wrapped their invocation into a Q-based promise chain. Thus,
each can either return the original generator, or may return a
promise that eventually resolves with that same generator.
2016-04-04 11:39:47 -07:00
Michael Krotscheck 0431c05fa2 Added .gitignore creation
Creates a gitignore file from a centralized list.
2016-03-29 10:59:06 -07:00
Michael Krotscheck 6816ccd658 Parse values from .gitreview
The gerrit module now reads its defaults from the .gitreview file,
rather than from .yo-rc.
2016-03-29 10:48:37 -07:00
Michael Krotscheck efa9fb66b3 Eslint support
Eslint configuration and ignore file are now generated, with
simple writeback support.
2016-03-29 08:33:23 -07:00
Michael Krotscheck a06cb9f35c Removed Gerrit Spec 2016-03-29 05:01:43 -07:00
Michael Krotscheck f48857e458 Consolidated generators
Having multiple generators stopped being manageable very quickly.
This collapses it all, and ensures tests still pass.

Also, this includes istanbul exclusions.
2016-03-24 13:37:40 -07:00
Michael Krotscheck b04257f194 Moved private generators into underscore namespace
Common generators can still be invoked, but at least the underscore
will hint to someone that they might be private.
2016-03-22 11:20:21 -07:00
Michael Krotscheck 4813ebdc82 Moved app tests into its own directory
Matches how the other generators are configured.
2016-03-22 10:41:11 -07:00
Michael Krotscheck 3febdb2f50 Enabled non-interactive mode
The --non-interactive flag runs the entire generator with the
pre-provided default options, never asking the user for
commandline feedback.
2016-03-22 10:39:25 -07:00
Michael Krotscheck e9301289d5 Store configuration options
Configuration options provided by the user are now stored
using the yeoman storage API, and not re-queried if already
set. This permits us to perform headless updates of a
project.
2016-03-22 09:24:06 -07:00
Michael Krotscheck bd640eb08c Corrected linting problems
This patch corrects any outstanding linting problems.
2016-03-22 07:19:59 -07:00
Michael Krotscheck fd284c419e Removed dummyfile
This file was created by the generator-generator. Now that the
default generator does something a little more useful, there's no
need to keep it around.
2016-03-22 07:19:37 -07:00
Michael Krotscheck 152991b048 Added license generator
This generator applies the Apache 2.0 license to all files.
2016-03-22 07:06:13 -07:00
Michael Krotscheck e701497011 Added editorconfig generator
This subgenerator creates the .editorconfig file.
2016-03-22 06:55:53 -07:00
Michael Krotscheck 1d9bba3bec Added openstack:gerrit generator
This generator creates a .gerritrc file, also used by the default
generator.
2016-03-22 06:42:15 -07:00
Michael Krotscheck f2d20d7c77 Removed gulp, added jasmine
This patch removes gulp, and moves commands such as nsp and test
execution directly into package.json. Coverage threshold tests via
istanbul have also been added.
2016-03-22 05:12:03 -07:00