Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove yarn support #12134

Merged
merged 22 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- ngx-gradle-psql-es-noi18n-mapsid
- ngx-gradle-mariadb-oauth2-infinispan
- ngx-gradle-mongodb-kafka-cucumber
- ngx-gradle-yarn-h2disk-ws-nocache
avdev4j marked this conversation as resolved.
Show resolved Hide resolved
- ngx-gradle-h2disk-ws-nocache
include:
- app-type: ngx-default
entity: sql
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
war: 0
protractor: 1
testcontainers: 0
- app-type: ngx-gradle-yarn-h2disk-ws-nocache
- app-type: ngx-gradle-h2disk-ws-nocache
entity: sql
profile: dev,webpack
war: 1
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ test/temp/
.vscode
.DS_Store
/.jhipster
yarn-error.log
*.sw?
/test/templates/import-jdl/*.png
.git
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,20 @@ Go to the [generator-jhipster project](https://github.com/jhipster/generator-jhi

[Please read the GitHub forking documentation for more information](https://help.github.com/articles/fork-a-repo)

### Set NPM/YARN to use the cloned project
### Set NPM to use the cloned project

In your cloned `generator-jhipster` project, type `npm link` or `yarn && yarn link` depending on the package manager you use.
In your cloned `generator-jhipster` project, type `npm link`.

This will do a symbolic link from the global `node_modules` version to point to this folder, so when we run `jhipster`, you will now use the development version of JHipster.

For testing, you will want to generate an application, and there is a specific issue here: for each application, JHipster installs a local version of itself. This is made to enable several applications to each use a specific JHipster version (application A uses JHipster 3.1.0, and application B uses JHipster 3.2.0).

To overcome this you need to run `npm link generator-jhipster` or `yarn link generator-jhipster` on the generated project folder as well, so that the local version has a symbolic link to the development version of JHipster.
To overcome this you need to run `npm link generator-jhipster` on the generated project folder as well, so that the local version has a symbolic link to the development version of JHipster.

To put it in a nutshell, you need to:

1. run `npm link` or `yarn link` on the `generator-jhipster` project
2. run `npm link generator-jhipster` or `yarn link generator-jhipster` on the generated application folder (you need to do this for each application you create)
1. run `npm link` on the `generator-jhipster` project
2. run `npm link generator-jhipster` on the generated application folder (you need to do this for each application you create)

Now, running the 'jhipster' command should run your locally installed JHipster version directly from sources. Check that the symbolic link is correct with the following command :

Expand Down
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ RUN \
tar -C /usr/local --strip-components 1 -xzf /tmp/node.tar.gz && \
# upgrade npm
npm install -g npm && \
# install yarn
npm install -g yarn && \
su -c "yarn config set prefix /home/jhipster/.yarn-global" jhipster && \
# install yeoman
npm install -g yo && \
# cleanup
Expand All @@ -53,9 +50,7 @@ COPY . /home/jhipster/generator-jhipster

RUN \
# clean jhipster folder
rm -Rf /home/jhipster/generator-jhipster/node_modules \
/home/jhipster/generator-jhipster/yarn.lock \
/home/jhipster/generator-jhipster/yarn-error.log && \
rm -Rf /home/jhipster/generator-jhipster/node_modules && \
# install jhipster
npm install -g /home/jhipster/generator-jhipster && \
# fix jhipster user permissions
Expand All @@ -71,7 +66,7 @@ RUN \

# expose the working directory, the Tomcat port, the BrowserSync ports
USER jhipster
ENV PATH $PATH:/usr/bin:/home/jhipster/.yarn-global/bin:/home/jhipster/.yarn/bin:/home/jhipster/.config/yarn/global/node_modules/.bin
ENV PATH $PATH:/usr/bin
WORKDIR "/home/jhipster/app"
VOLUME ["/home/jhipster/app"]
EXPOSE 8080 9000 3001
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ Additional builds at [hipster-labs/jhipster-daily-builds](https://github.com/hip
| [![Vue Gradle NoSQL][github-vue-gradle-nosql]][github-actions] |
| [![Elasticsearch][github-elasticsearch]][github-actions] |
| [![Monolith OAuth2][github-monolith-oauth2]][github-actions] |
| [![Yarn][github-yarn]][github-actions] |
| [![No Database][github-no-database]][github-actions] |
| [![Microservices JWT][github-ms-jwt]][github-actions] |
| [![Microservices OAuth2][github-ms-oauth2]][github-actions] |
Expand Down Expand Up @@ -179,7 +178,6 @@ Additional builds at [hipster-labs/jhipster-daily-builds](https://github.com/hip
[github-vue-gradle-nosql]: https://github.com/hipster-labs/jhipster-daily-builds/workflows/Vue%20Gradle%20NoSQL/badge.svg
[github-elasticsearch]: https://github.com/hipster-labs/jhipster-daily-builds/workflows/Elasticsearch/badge.svg
[github-monolith-oauth2]: https://github.com/hipster-labs/jhipster-daily-builds/workflows/Monolith%20OAuth2/badge.svg
[github-yarn]: https://github.com/hipster-labs/jhipster-daily-builds/workflows/Yarn/badge.svg
[github-no-database]: https://github.com/hipster-labs/jhipster-daily-builds/workflows/No%20Database/badge.svg
[github-ms-jwt]: https://github.com/hipster-labs/jhipster-daily-builds/workflows/Microservices%20JWT/badge.svg
[github-ms-oauth2]: https://github.com/hipster-labs/jhipster-daily-builds/workflows/Microservices%20OAuth2/badge.svg
Expand Down
2 changes: 0 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ jobs:
displayName: 'TOOLS: install google-chrome-stable'
- script: npm install -g npm
displayName: 'TOOLS: update NPM'
- script: npm install -g yarn
displayName: 'TOOLS: install Yarn'
- bash: $(JHI_SCRIPTS)/01-display-configuration.sh
displayName: 'TOOLS: display configuration'
- bash: $(JHI_SCRIPTS)/03-system.sh
Expand Down
11 changes: 2 additions & 9 deletions cli/import-jdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const generateEntityFiles = (processor, entity, inFolder, env, shouldTriggerInst
};

/**
* Check if NPM/Yarn install needs to be triggered. This will be done for the last entity.
* Check if NPM install needs to be triggered. This will be done for the last entity.
* @param {any} processor
* @param {number} index
*/
Expand Down Expand Up @@ -255,14 +255,7 @@ class JDLProcessor {
this.skipClient = configuration.skipClient;
this.clientFramework = configuration.clientFramework;
this.clientFramework = this.clientFramework || ANGULAR;
this.clientPackageManager = configuration.clientPackageManager;
if (!this.clientPackageManager) {
if (this.useNpm) {
this.clientPackageManager = 'npm';
} else {
this.clientPackageManager = 'yarn';
}
}
this.clientPackageManager = configuration.clientPackageManager || 'npm';
}
}

Expand Down
11 changes: 0 additions & 11 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,6 @@ module.exports = class extends BaseBlueprintGenerator {
type: String,
});

// This adds support for a `--yarn` flag
this.option('yarn', {
desc: 'Use yarn instead of npm',
type: Boolean,
defaults: false,
});

// This adds support for a `--auth` flag
this.option('auth', {
desc: 'Provide authentication type for the application when skipping server side generation',
Expand Down Expand Up @@ -254,10 +247,6 @@ module.exports = class extends BaseBlueprintGenerator {
this.checkGit();
},

validateYarn() {
this.checkYarn();
},

checkForNewJHVersion() {
if (!this.skipChecks) {
this.checkForNewVersion();
Expand Down
3 changes: 0 additions & 3 deletions generators/aws-containers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@ The token received by ECR to authenticate is structured as follows. We'll only t
```
# NPM
npm i --save-dev aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0

# Yarn
yarn add --dev aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0
```
1 change: 0 additions & 1 deletion generators/ci-cd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ module.exports = class extends BaseGenerator {
},
initConstants() {
this.NODE_VERSION = constants.NODE_VERSION;
this.YARN_VERSION = constants.YARN_VERSION;
this.NPM_VERSION = constants.NPM_VERSION;
},
getConstants() {
Expand Down
9 changes: 0 additions & 9 deletions generators/ci-cd/templates/.gitlab-ci.yml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,7 @@ before_script:
- export MAVEN_USER_HOME=`pwd`/.maven
<%_ if (!skipClient) { _%>
<%_ if (!insideDocker) { _%>
<%_ if (clientPackageManager === 'yarn') { _%>
- ./mvnw -ntp com.github.eirslett:frontend-maven-plugin:install-node-and-yarn -DnodeVersion=v<%= NODE_VERSION %> -DyarnVersion=v<%= YARN_VERSION %> -Dmaven.repo.local=$MAVEN_USER_HOME
<%_ } else if (clientPackageManager === 'npm') { _%>
- ./mvnw -ntp com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v<%= NODE_VERSION %> -DnpmVersion=<%= NPM_VERSION %> -Dmaven.repo.local=$MAVEN_USER_HOME
<%_ } _%>
- ./mvnw -ntp com.github.eirslett:frontend-maven-plugin:<%= clientPackageManager %> -Dmaven.repo.local=$MAVEN_USER_HOME
<%_ } _%>
<%_ } _%>
Expand Down Expand Up @@ -228,13 +224,8 @@ frontend-test:
stage: test
script:
<%_ if (insideDocker) { _%>
<%_ if (clientPackageManager === 'yarn') { _%>
- yarn install
- yarn test
<%_ } else if (clientPackageManager === 'npm') { _%>
- npm install
- npm test
<%_ } _%>
<%_ } else { _%>
- ./mvnw -ntp com.github.eirslett:frontend-maven-plugin:<%= clientPackageManager %> -Dfrontend.<%= clientPackageManager %>.arguments='run <%= frontTestCommand %>' -Dmaven.repo.local=$MAVEN_USER_HOME
<%_ } _%>
Expand Down
9 changes: 0 additions & 9 deletions generators/ci-cd/templates/azure-pipelines.yml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,10 @@ jobs:
# Tests
#----------------------------------------------------------------------
<%_ if (!skipClient) { _%>
<%_ if (clientPackageManager === 'yarn') { _%>
- script: yarn install
displayName: 'INSTALL: launch yarn install'
<%_ } else if (clientPackageManager === 'npm') { _%>
- task: Npm@1
inputs:
command: 'install'
displayName: 'INSTALL: launch npm install'
<%_ } _%>
<%_ } _%>
<%_ if (!skipServer) { _%>
<%_ if (buildTool === 'maven') { _%>
Expand All @@ -66,14 +61,10 @@ jobs:
displayName: 'TESTS: backend'
<%_ } _%>
<%_ if (!skipClient) { _%>
<%_ if (clientPackageManager === 'yarn') { _%>
- script: yarn <%= frontTestCommand %>
<%_ } else if (clientPackageManager === 'npm') { _%>
- task: Npm@1
inputs:
command: 'custom'
customCommand: 'run <%= frontTestCommand %>'
<%_ } _%>
displayName: 'TESTS: frontend'
<%_ } _%>
<%_ if (!skipServer) { _%>
Expand Down
31 changes: 2 additions & 29 deletions generators/ci-cd/templates/circle.yml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ jobs:
# Download and cache dependencies
- restore_cache:
keys:
<%_ if (buildTool === 'maven' && clientPackageManager === 'npm') { _%>
<%_ if (buildTool === 'maven') { _%>
- v1-dependencies-{{ checksum "pom.xml" }}-{{ checksum "package-lock.json" }}
<%_ } else if (buildTool === 'maven' && clientPackageManager === 'yarn') { _%>
- v1-dependencies-{{ checksum "pom.xml" }}-{{ checksum "yarn.lock" }}
<%_ } else if (buildTool === 'gradle' && clientPackageManager === 'npm') { _%>
<%_ } else if (buildTool === 'gradle') { _%>
- v1-dependencies-{{ checksum "build.gradle" }}-{{ checksum "package-lock.json" }}
<%_ } else if (buildTool === 'gradle' && clientPackageManager === 'yarn') { _%>
- v1-dependencies-{{ checksum "build.gradle" }}-{{ checksum "yarn.lock" }}
<%_ } _%>
# Perform a Partial Cache Restore (https://circleci.com/docs/2.0/caching/#restoring-cache)
- v1-dependencies-
Expand All @@ -56,32 +52,18 @@ jobs:
command: |
nvm install <%= NODE_VERSION %>
nvm alias default <%= NODE_VERSION %>
<%_ if (clientPackageManager === 'yarn') { _%>
- run:
name: Set URL for Yarn
command: 'curl -o- -L https://yarnpkg.com/install.sh | bash'
- run:
name: Set PATH
command: echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> $BASH_ENV
<%_ } _%>
- run:
name: Print Java Version
command: 'java -version'
- run:
name: Print Node Version
command: 'node -v'
<%_ if (clientPackageManager === 'npm') { _%>
- run:
name: Print NPM Version
command: 'npm -v'
<%_ } _%>
- run:
name: Install Node Modules
<%_ if (clientPackageManager === 'npm') { _%>
command: 'npm install'
<%_ } else if (clientPackageManager === 'yarn') { _%>
command: 'yarn install'
<%_ } _%>

- save_cache:
paths:
Expand All @@ -92,20 +74,11 @@ jobs:
<%_ } else if (buildTool === 'gradle') { _%>
- ~/.gradle
<%_ } _%>
<%_ if (clientPackageManager === 'npm') { _%>
<%_ if (buildTool === 'maven') { _%>
key: v1-dependencies-{{ checksum "pom.xml" }}-{{ checksum "package-lock.json" }}
<%_ } else if (buildTool === 'gradle') { _%>
key: v1-dependencies-{{ checksum "build.gradle" }}-{{ checksum "package-lock.json" }}
<%_ } _%>
<%_ } else if (clientPackageManager === 'yarn') { _%>
- $HOME/.yarn-cache
<%_ if (buildTool === 'maven') { _%>
key: v1-dependencies-{{ checksum "pom.xml" }}-{{ checksum "yarn.lock" }}
<%_ } else if (buildTool === 'gradle') { _%>
key: v1-dependencies-{{ checksum "build.gradle" }}-{{ checksum "yarn.lock" }}
<%_ } _%>
<%_ } _%>

<%_ if (buildTool === 'maven') { _%>
- run:
Expand Down
16 changes: 0 additions & 16 deletions generators/ci-cd/templates/jenkins/Jenkinsfile.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ node {
<%= indent %> }

<%_ if (!skipClient) { _%>
<%_ if (clientPackageManager === 'yarn') { _%>
<%= indent %> stage('install tools') {
<%= indent %> sh "./mvnw -ntp com.github.eirslett:frontend-maven-plugin:install-node-and-yarn -DnodeVersion=v<%= NODE_VERSION %> -DyarnVersion=v<%= YARN_VERSION %>"
<%= indent %> }

<%= indent %> stage('yarn install') {
<%= indent %> sh "./mvnw -ntp com.github.eirslett:frontend-maven-plugin:yarn"
<%= indent %> }

<%_ } else if (clientPackageManager === 'npm') { _%>
<%= indent %> stage('install tools') {
<%= indent %> sh "./mvnw -ntp com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v<%= NODE_VERSION %> -DnpmVersion=<%= NPM_VERSION %>"
<%= indent %> }
Expand All @@ -61,7 +51,6 @@ node {
<%= indent %> sh "./mvnw -ntp com.github.eirslett:frontend-maven-plugin:npm"
<%= indent %> }

<%_ } _%>
<%_ } _%>
<%= indent %> stage('backend tests') {
<%= indent %> try {
Expand All @@ -77,13 +66,8 @@ node {
<%= indent %> stage('frontend tests') {
<%= indent %> try {
<%_ if (insideDocker) { _%>
<%_ if (clientPackageManager === 'yarn') { _%>
<%= indent %> yarn install
<%= indent %> yarn test
<%_ } else if (clientPackageManager === 'npm') { _%>
<%= indent %> npm install
<%= indent %> npm test
<%_ } _%>
<%_ } else { _%>
<%= indent %> sh "./mvnw -ntp com.github.eirslett:frontend-maven-plugin:<%= clientPackageManager %> -Dfrontend.<%= clientPackageManager %>.arguments='run <%= frontTestCommand %>'"
<%_ } _%>
Expand Down
10 changes: 0 additions & 10 deletions generators/ci-cd/templates/travis.yml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ cache:
<%_ } else if (buildTool === 'gradle') { _%>
- $HOME/.gradle
<%_ } _%>
<%_ if (clientPackageManager === 'yarn') { _%>
- $HOME/.yarn-cache
<%_ } _%>
env:
global:
- NODE_VERSION=<%= NODE_VERSION %>
Expand All @@ -60,17 +57,10 @@ before_install:
- java -version
- sudo /etc/init.d/mysql stop
- sudo /etc/init.d/postgresql stop
<%_ if (clientPackageManager === 'npm') { _%>
- nvm install $NODE_VERSION
- npm install -g npm
- node -v
- npm -v
<%_ } _%>
<%_ if (clientPackageManager === 'yarn') { _%>
# Repo for Yarn
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
<%_ } _%>
install:
- <%= clientPackageManager %> install
script:
Expand Down
3 changes: 1 addition & 2 deletions generators/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ module.exports = class extends BaseBlueprintGenerator {

const installConfig = {
bower: false,
npm: this.clientPackageManager !== 'yarn',
yarn: this.clientPackageManager === 'yarn',
npm: true,
};

if (this.options.skipInstall) {
Expand Down
Loading